﻿#pragma once
// Copyright (c) lanyeo 2020-2021
// Licenced under MIT license. See https://opensource.org/licenses/MIT for details.
// code style
// 1. use forward declaration (尽可能使用前置声明)
// 2. include file sequence [other project>c>c++>third>self project]
//
#include <util/fist-time-inl.h>
#include <string>

class IFistConfig
{
public:
    // 默认5分钟检查一次
    static constexpr uint32_t FILE_CHECK_TIME = 5 * 60 * 1000;

    explicit IFistConfig();
    virtual ~IFistConfig();

    bool Load(const char* filepath);

    virtual bool Update();

    virtual bool Read(const std::string& filepath) = 0;
private:
    bool CheckFileChange();
private:
    std::string m_filepath;
    fist::ms_t m_next_check;
    fist::ms_t m_last_modify;
};
